home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / mp / mp.pro.ps.z / mp.pro.ps
Encoding:
Text File  |  1997-01-22  |  5.1 KB  |  194 lines

  1. %!PS-Adobe-1.0
  2. %%Creator: Steve Holden
  3. %%Modified: John Macdonald, Rich Burridge, Rainer Klute
  4. %%Modified: Bertrand Decouty, Bjorn P. Brox
  5. %%Title: @(#)mp.pro.ps 1.7 92/02/17
  6. %%CreationDate: see above
  7. %%PageLength 60
  8. %%LineLength 80
  9. %%DocumentFonts: Courier Helvetica-BoldOblique Times-Bold Times-Roman
  10. %%ShowZcodeLogo
  11. %%ShowXface
  12. %%Pages: (atend)
  13. %%EndComments
  14.  
  15. /setmargin {
  16.   /leftedge 0 def
  17.   /bottomedge 0 def
  18.   fullheight fullwidth LandscapeMode { exch } if
  19.     /rightedge exch def
  20.     /topedge exch def
  21.   9 7 LandscapeMode { exch } if pop
  22.     /FontSize exch def
  23.  
  24.   /font1d /Times-Bold           reencodeISO
  25.   /font2d /Times-Roman          reencodeISO
  26.   /CourierISO /Courier          reencodeISO
  27.   /fontHd /Helvetica-BoldOblique        reencodeISO
  28.   /fontH2 /Helvetica-BoldOblique        reencodeISO
  29.   /fontNd /Times-Bold           reencodeISO
  30.   /font3d backspacefont
  31.  
  32.   /BoldFont      { /font1d findfont FontSize scalefont setfont } def
  33.   /pf            { /font2d findfont FontSize scalefont setfont } def
  34.   /sf            { /font3d findfont FontSize scalefont setfont } def
  35.   /fontH         { /fontHd findfont 14 scalefont setfont } def
  36.   /fontD         { /fontH2 findfont 10 scalefont setfont } def
  37.   /fontN         { /fontNd findfont 12 scalefont setfont } def
  38. } def
  39.  
  40. /graybox    % grey x1 y1 x2 y2 graybox --
  41. {
  42.     newpath
  43.       4 -1 roll 2 copy            % y2 x1
  44.       10 sub exch moveto
  45.       4 -1 roll 2 copy            % x1 y1
  46.       10 180 270 arc
  47.       4 -1 roll 1 copy 3 -1 roll    % x2 y1
  48.       10 270 0 arc
  49.       3 -1 roll 1 copy 3 1 roll        % x1 y2 x2 y2
  50.       10 0 90 arc
  51.       10 90 180 arc
  52.     closepath
  53.     gsave
  54.       setgray fill
  55.     grestore
  56.     0 setgray stroke
  57. } bind def
  58.  
  59. /endpage        % page_number endpage --
  60. {
  61.   gsave
  62.     % listing type, user, date across the top
  63.     0.88                                % gray level
  64.     leftedge  50 add topedge 56 sub     % bottom lt corner
  65.     rightedge 95 sub topedge 36 sub     % top rt corner
  66.     graybox
  67.  
  68.     currentdict /sfactor known not
  69.     {
  70.       % determine a suitable factor to scale down the header text (done
  71.       % only once per document)
  72.       rightedge 95 sub leftedge 50 add sub % available space
  73.       fontD MailFor stringwidth pop
  74.       fontH User    stringwidth pop add
  75.             (  )    stringwidth pop add
  76.       fontD TimeNow stringwidth pop add    % total length of strings
  77.       div
  78.       dup 1 gt {pop 1} if                  % does it fit?
  79.       /sfactor exch def                    % if not scale down
  80.     }
  81.     if
  82.  
  83.     leftedge 50 add topedge 50 sub moveto
  84.     gsave
  85.     sfactor dup scale
  86.     fontD MailFor show
  87.     fontH User    show
  88.           (  )    show
  89.     grestore
  90.     fontD
  91.     rightedge 95 sub TimeNow stringwidth pop sfactor mul sub
  92.     topedge 50 sub moveto
  93.     gsave
  94.     sfactor dup scale
  95.     TimeNow show
  96.     grestore
  97.     % page number to the top right corner
  98.     1                                   % gray level
  99.     rightedge 70 sub topedge 56 sub     % bottom lt
  100.     rightedge 50 sub topedge 36 sub     % top rt
  101.     graybox
  102.     fontD
  103.     (Page) dup stringwidth
  104.        topedge 40 sub exch sub                  % y-centered
  105.        exch 2 div rightedge 60 sub exch sub     % x-centered
  106.        exch moveto show
  107.     fontH
  108.     dup stringwidth
  109.        topedge 58 sub exch sub                  % y-centered
  110.        exch 2 div rightedge 60 sub exch sub     % x-centered
  111.        exch moveto show
  112.     1
  113.     rightedge 70 sub bottomedge 50 add     % top rt corner
  114.     rightedge 50 sub bottomedge 70 add     % bottom lt corner
  115.     graybox
  116.     gsave
  117.     rightedge 75 sub bottomedge 45 add     % top rt corner
  118.     translate
  119.     30 30 scale
  120.     hasface {
  121.     /picstr 48 string def
  122.     48 48 8
  123.     [48 0 0 -48 0 48]
  124.     { currentfile picstr readhexstring pop }
  125.     image
  126.     } {
  127.     /picstr 150 string def
  128.     150 136 8
  129.     [150 0 0 -136 0 136]
  130.     { currentfile picstr readhexstring pop }
  131.     image
  132.     } ifelse
  133.     grestore
  134.  
  135.     0.88                                   % gray level
  136.     leftedge  50 add bottomedge 50 add     % bottom lt corner
  137.     rightedge 95 sub bottomedge 70 add     % top rt corner
  138.     graybox
  139.     fontH
  140.     % compute x pos for centring
  141.       % ((l+50) + (r-50)) / 2 is the page centre
  142.       leftedge rightedge add 2 div
  143.       % but we want to start at the beginning of the string, not the middle
  144.       Subject stringwidth pop 2 div sub
  145.     % y pos is simple
  146.       bottomedge 54 add
  147.       moveto
  148.     Subject show
  149.   grestore
  150. %  PageSave restore      % restore *always* before showpage
  151.   showpage        % display it
  152. } bind def
  153.  
  154. /endcol            % page_number col_number endcol --
  155. {
  156.   pop            % get rid of col_number
  157.   pop                   % get rid of page_number
  158.   /ypos topedge 92 sub def
  159.   /xpos rightedge leftedge sub 2 div def
  160.   xpos ypos moveto
  161. } bind def
  162.  
  163. /newpage    % page_number newpage --
  164. {
  165.   pop        % pageno
  166. %  /PageSave save def
  167.   LandscapeMode {setlandscape} if
  168.   /lct 0 def
  169.   /ypos topedge 92 sub def
  170.   /xpos leftedge 50 add def
  171.   xpos ypos moveto
  172.   sf
  173. } bind def
  174.  
  175. /setlandscape
  176. {
  177.   612 0 translate
  178.   90 rotate
  179. } bind def
  180.  
  181. /showline
  182. {
  183.   show
  184.   /ypos ypos FontSize sub def
  185.   xpos ypos moveto
  186. } bind def
  187.  
  188. % see the trouble shooting section in the README for details on setscreen.
  189. 106 45 {dup mul exch dup mul add 1.0 exch sub} setscreen
  190.  
  191. /LandscapeMode false def
  192.  
  193. setmargin
  194.